package com.wzz.seckillone.activeMq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.MapMessage;
import javax.jms.Queue;
import javax.jms.Topic;

/**
 * @ProjectName: seckillOne
 * @Package: com.wzz.seckillone.activeMq
 * @ClassName: ActiveMqSendMsgToTopic
 * @Author: wzz
 * @Description: 消息发送
 * @Date: 2022/3/21 15:05
 * @Version: 1.0
 */
@Component
@Slf4j
public class MqSend {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;
    @Autowired
    private Queue queue;

    public void sendMsg(String message){
        log.info("发送消息"+message);
        jmsMessagingTemplate.convertAndSend(queue,message);
    }
}
